import config from '@/utils/config'
let appVersion = uni.getSystemInfoSync().appVersion
let osName = uni.getSystemInfoSync().osName
export const uploadFilePromise = (url) => {
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: config.baseUrl+'/system/oss/upload',
			filePath: url,
			name: 'file',
			header: {
				Authorization: uni.getStorageSync('accessToken'),
				'Tenant-Id': config.tenentId,
				'AppVersion': `${osName}/${appVersion}`
			},
			success: (res) => {
				resolve(JSON.parse(res.data))
			},
			fail: (error) => {
				reject(error)
			}
		});
	})
}
